//提供 封装了 执行 登录 注册 相关功能的 异步请求的api方法
//导入 axios
import axios from "@/utils/request.js";


//按需导出 api方法
export const getRoles = () => axios({
    url: 'roles',
    method: 'get',
})

export const editRoles = (id) => axios({
    url:`roles/${id}`
})

export const subEditRoles = (id, params) => axios( {
    url:`roles/${id}`,
    method: 'put',
    data:params
})

export const delEditRoles = (id) => axios({
    url: `roles/${id}`,
    method:'delete'
})

export const delRoleRight = (roleId, id) => axios({
    url: `roles/${roleId}/rights/${id}`,
    method:'delete'
})

export const setAllRight = (type) => axios({
    url: `rights/${type}`,
    method:'get'
})

export const allotRole = (roleId, rights) => axios({
    url: `roles/${roleId}/rights`,
    method: 'post',
    data:rights
})

export const addRoles = (params) => axios({
    url: 'roles',
    method: 'post',
    data:params
})